package com.zhenmaitang.clinic_sys.exception;

import com.zhenmaitang.clinic_sys.common.AuthResultCode;

/**
 * 业务异常类
 * 用于封装业务逻辑中的各种异常情况
 */
public class BusinessException extends RuntimeException {
    
    private final AuthResultCode resultCode;
    
    public BusinessException(AuthResultCode resultCode) {
        super(resultCode.getMessage());
        this.resultCode = resultCode;
    }
    
    public BusinessException(AuthResultCode resultCode, String message) {
        super(message);
        this.resultCode = resultCode;
    }
    
    public AuthResultCode getResultCode() {
        return resultCode;
    }
    
    public int getCode() {
        return resultCode.getCode();
    }
    
    public String getMessage() {
        return resultCode.getMessage();
    }
}